Skip to content

build: fix cctest target with --enable-static#17992

Closed
liqyan wants to merge 1 commit into
nodejs:masterfrom
liqyan:fix_cctest_build
Closed

build: fix cctest target with --enable-static#17992
liqyan wants to merge 1 commit into
nodejs:masterfrom
liqyan:fix_cctest_build

Conversation

@liqyan

@liqyan liqyan commented Jan 5, 2018

Copy link
Copy Markdown
Contributor

ref issue: #17991
Currently the cctest target build will fail if configured with --enable-static

$ ./configure --enable-static
$ make

There're some function multiple definition errors such as:

  out/Release/obj.target/node/src/node_crypto.o: In function `node::crypto::RandomBytesWork(uv_work_s*)':
  node_crypto.cc:(.text+0x60): multiple definition of `node::crypto::RandomBytesWork(uv_work_s*)'
  out/Release/obj.target/node/src/node_crypto.o:node_crypto.cc:(.text+0x60): first defined here

It's caused by repetition objects in libraries and libnode.a.
This CL makes those libraries guarded by 'node_target_type!="static_library"'.

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • documentation is changed or added
  • commit message follows commit guidelines
Affected core subsystem(s)

build

@nodejs-github-bot nodejs-github-bot added the build Issues and PRs related to build files or the CI. label Jan 5, 2018

@mmarchini mmarchini left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for working on this and welcome! The changes (adding a check for node_target_type) look fine, but the diff is too big because there's reallocation of some conditions (e.g. moving node_use_dtrace before node_use_openssl), making it harder to review and to look at the git log in the future. Could you try to keep the changes to a minimum, focusing only on what's important to this PR? (unless the reallocations are necessary)

Comment thread node.gyp Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure I understood this comment

Currently the cctest target build will fail if configured with --enable-static

$ ./configure --enable-static
$ make

There're some function multiple definition errors such as:
  out/Release/obj.target/node/src/node_crypto.o: In function `node::crypto::RandomBytesWork(uv_work_s*)':
  node_crypto.cc:(.text+0x60): multiple definition of `node::crypto::RandomBytesWork(uv_work_s*)'
  out/Release/obj.target/node/src/node_crypto.o:node_crypto.cc:(.text+0x60): first defined here

It's caused by repetition objects in libraries and libnode.a.
This CL makes those libraries guarded by 'node_target_type!="static_library"'.
@liqyan

liqyan commented Jan 5, 2018

Copy link
Copy Markdown
Contributor Author

I updated node.gyp to minimize the changes.

@gibfahn

gibfahn commented Jan 7, 2018

Copy link
Copy Markdown
Member

Maybe cc/ @danbev @yhwang for review.

@yhwang

yhwang commented Jan 8, 2018

Copy link
Copy Markdown
Member

The fix looks good for me. However, I am also doing the static/shared lib refine here: #17604
I removed the 'node_target_type!="static_library" in cctest target and made it more general for static/shared lib cases.

I guess the fix here will be overrode by my change if this change lands first.

@yhwang yhwang left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@danbev

danbev commented Jan 8, 2018

Copy link
Copy Markdown
Contributor

jasnell pushed a commit that referenced this pull request Jan 9, 2018
Currently the cctest target build will fail if configured with --enable-static

$ ./configure --enable-static
$ make

There're some function multiple definition errors such as:
  out/Release/obj.target/node/src/node_crypto.o: In function `node::crypto::RandomBytesWork(uv_work_s*)':
  node_crypto.cc:(.text+0x60): multiple definition of `node::crypto::RandomBytesWork(uv_work_s*)'
  out/Release/obj.target/node/src/node_crypto.o:node_crypto.cc:(.text+0x60): first defined here

It's caused by repetition objects in libraries and libnode.a.
This CL makes those libraries guarded by 'node_target_type!="static_library"'.

PR-URL: #17992
Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
@jasnell

jasnell commented Jan 9, 2018

Copy link
Copy Markdown
Member

Landed in 23c9597

@jasnell jasnell closed this Jan 9, 2018
evanlucas pushed a commit that referenced this pull request Jan 22, 2018
Currently the cctest target build will fail if configured with --enable-static

$ ./configure --enable-static
$ make

There're some function multiple definition errors such as:
  out/Release/obj.target/node/src/node_crypto.o: In function `node::crypto::RandomBytesWork(uv_work_s*)':
  node_crypto.cc:(.text+0x60): multiple definition of `node::crypto::RandomBytesWork(uv_work_s*)'
  out/Release/obj.target/node/src/node_crypto.o:node_crypto.cc:(.text+0x60): first defined here

It's caused by repetition objects in libraries and libnode.a.
This CL makes those libraries guarded by 'node_target_type!="static_library"'.

PR-URL: #17992
Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
evanlucas pushed a commit that referenced this pull request Jan 30, 2018
Currently the cctest target build will fail if configured with --enable-static

$ ./configure --enable-static
$ make

There're some function multiple definition errors such as:
  out/Release/obj.target/node/src/node_crypto.o: In function `node::crypto::RandomBytesWork(uv_work_s*)':
  node_crypto.cc:(.text+0x60): multiple definition of `node::crypto::RandomBytesWork(uv_work_s*)'
  out/Release/obj.target/node/src/node_crypto.o:node_crypto.cc:(.text+0x60): first defined here

It's caused by repetition objects in libraries and libnode.a.
This CL makes those libraries guarded by 'node_target_type!="static_library"'.

PR-URL: #17992
Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
MylesBorins pushed a commit that referenced this pull request Feb 27, 2018
Currently the cctest target build will fail if configured with --enable-static

$ ./configure --enable-static
$ make

There're some function multiple definition errors such as:
  out/Release/obj.target/node/src/node_crypto.o: In function `node::crypto::RandomBytesWork(uv_work_s*)':
  node_crypto.cc:(.text+0x60): multiple definition of `node::crypto::RandomBytesWork(uv_work_s*)'
  out/Release/obj.target/node/src/node_crypto.o:node_crypto.cc:(.text+0x60): first defined here

It's caused by repetition objects in libraries and libnode.a.
This CL makes those libraries guarded by 'node_target_type!="static_library"'.

PR-URL: #17992
Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
@MylesBorins

Copy link
Copy Markdown
Contributor

This lands cleanly on v8.x but requires a manual backport for v6.x

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

build Issues and PRs related to build files or the CI.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants